package net.xiangcaowuyu.example1.controller;

import net.xiangcaowuyu.example1.dao.AndUserRepository;
import net.xiangcaowuyu.example1.domain.AndUser;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 博客：https://www.xiangcaowuyu.net
 * Description:
 *
 * @Author: 香草物语
 * DateTime: 2021-07-21 15:07
 */
@RestController
@RequestMapping("/andUser")
public class AndUserController {

    @Resource
    private AndUserRepository andUserRepository;

    @Value("${person.name}")
    public String personName;

    @GetMapping("/findAll")
    @Transactional
    public List<AndUser> findAll() {
        return andUserRepository.findAllByAgeAndName(0, "张三");
    }

}
